import { resolve } from "node:path"
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
import { UnifiedViteWeappTailwindcssPlugin as uvwt } from "weapp-tailwindcss/vite";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [uni(), uvwt()],
  css: {
    postcss: {
      plugins: [tailwindcss(), autoprefixer()],
    },
  },
  server: {
    https: false,
    port: 3000,
    proxy: {
      "/index.php/api/": {
        ws: false,
        target: "https://yunduanshop.rchz.top",
        changeOrigin: true,
        secure: false,
      },
    },
  },

  // 配置别名
  resolve: {
    alias: {
      find: '@',
      replacement: resolve(__dirname, "src"),
    },
  },
});
